#-------------------------------------------------------------------------------
`
Run this function to compute the simulations of the model and to create all the tables and figures.
`
#-------------------------------------------------------------------------------

#Set path for Argentine data
global Arg_Data_path     = "../../Empirics/00_data/02_output/";
global EMBI_data         =  "ARG_EMBI_quant.csv"
global Misreport_data    =  "InfMisreport_Series.txt"
global Output_data       =  "GDPcyc_ARG.csv"


#Load functions for simulations
include("01_Model_Structure.jl");
include("02_Functions.jl");
include("10_Simulations_Main_fx.jl")
include("12_Simulations_Wrapper.jl")
using Interpolations, Optim, Roots, JLD, Plots
using Distributions, StatsBase

for i=0:1

     if i==0
          @printf("Simulating for alternating types \n")
          name_f = "_PerfectInfo"
          do_ConsTypes=0
          Initial_Type=1
     elseif i==1
          @printf("Simulating for constant C-type \n")
          name_f = "_Ctype"
          do_ConsTypes=1
          Initial_Type=1
     end

     # Load Solution & Store in ce structure
     name_file = ifelse(do_ConsTypes==0, string("CE_model_PerfInfo.jld"), string("CE_model_ConsTypes.jld") )
     ce = load(string("model_data/",name_file), "ce")

     target_mms_Ctype  = Simulations_Wrapper(ce, Initial_Type)

     #-------------------------------------------------------------------------------
     ###  WRITE TABLES WITH SIMULATED MOMENTS INTO TEXT FILES
     #-------------------------------------------------------------------------------
     open(string("simulated_moments/target_moments",name_f,".txt"), "w") do io
     writedlm(io, target_mms_Ctype, ',')
     end
end

#CREATE TABLE 9 - COMPARISON ACROSS MODELS
#-------------------------------------------------------------------------------
include("31_Create_Tables.jl")
#-------------------------------------------------------------------------------
